<template>
	<view class="bg">
		<view @click="leftClick()" class="leftButton fixed-top " style="">
			<u-icon name="arrow-left" color="white" size="26"></u-icon>
		</view>
		<view v-if='status==1' class="">
			<image class="BGImage1" src="/static/settled/bg.png" mode=""></image>
			<view class="bgView flex-row-center">
				<view class="bgView1 flex-column-center">
					<image class="image" src="/static/settled/1.png" mode=""></image>
					<view class="title">
						审核通过
					</view>
					<view @click="goFan" class="button flex-row-center">
						点击进入达人端
					</view>
				</view>
			</view>
		</view>
		<view v-else-if='status==2' class="">
			<image class="BGImage1" src="/static/settled/bg.png" mode=""></image>
			<view class="bgView flex-row-center">
				<view class="bgView1 flex-column-center">
					<image class="image" src="/static/settled/1.png" mode=""></image>
					<view class="title">
						审核已驳回
					</view>
					<view @click="togo()" class="button flex-row-center">
						重新填写
					</view>
				</view>
			</view>
		</view>
		<view v-else-if='status==0' class="">
			<image class="BGImage1" src="/static/settled/bg.png" mode=""></image>
			<view class="bgView flex-row-center">
				<view class="bgView1 flex-column-center">
					<image class="image" src="/static/settled/1.png" mode=""></image>
					<view class="title">
						审核中
					</view>
					<!-- <view @click="togo()" class="button flex-row-center">
						重新填写
					</view> -->
				</view>
			</view>
		</view>
		<view v-else class="flex-col page">
			<image class="BGImage1" src="/static/settled/bg.png" mode=""></image>
			<view class="flex-col group">
				<!-- 	<image
				src="/static/img/zunshangs.jpg"
				class="image_1" /> -->

				<view class="flex-col group_1" style=" ">
					<view class="position-relative">
						<!-- <view class="border-radius-100"
							style="width:200rpx;height:200rpx;border:8rpx solid #fff;overflow: hidden;">
							<image :src="avatar" mode="aspectFill" class="img" style="width:200rpx;height:200rpx;">
							</image>
							<view class="position-absolute" style="bottom:0;right:0;" @tap="upload3()">
								<image
									src="http://nianerge.oss-cn-beijing.aliyuncs.com/nianerge/images/mineImg/img01.png"
									mode="" class="img" style="width:74rpx;height:74rpx;"></image>
							</view>
						</view> -->
					</view>

					<view class="flex-col">
						<!-- <view class="flex-row section_1">
							<text class="text_1">达人姓名</text>
							<input class="text_2" type="text" v-model.trim="realname" placeholder="请输入姓名" />
						</view> -->
						<view class="section_3 flex-row" @tap="upload3()"
							style="justify-content: space-between;align-items: center;">
							<text class="text_6"><span style="color: red;">*</span>首页照片</text>
							<image :src="avatar||'/static/tx.jpeg'" mode="aspectFill" class="img"
								style="width:80rpx;height:80rpx;">

						</view>

						<view class="section_3 flex-row">
							<text class="text_6"><span style="color: red;">*</span>联系方式</text>
							<input class="text_7" type="number" v-model.trim="mobile" placeholder="请输入联系方式" />

						</view>
						<view class="section_3 flex-row" style="position: relative;">
							<text class="text_6"><span style="color: red;">*</span>验证码</text>
							<input class="text_7" type="number" v-model.trim="phone_code" placeholder="请输入验证码" />
							<view class="centent_code" @click="send()">{{clockText}}</view>
						</view>
						<view class="section_3 flex-row">
							<text class="text_6"><span style="color: red;">*</span>昵称</text>
							<input type="text" v-model.trim="nickname" maxlength="4" class="text_7"
								placeholder="输入昵称(最多四个字)" placeholder-class="">

						</view>

						<view class="section_3 flex-row" style="position: relative;">

							<text class="text_6"><span style="color: red;">*</span>身份证姓名</text>
							<input type="text" v-model="realname" class="text_7" placeholder="输入身份证姓名"
								placeholder-class="">

						</view>
						<view class="section_3 flex-row" style="position: relative;">
							<view class=""
								style="position: absolute;left: 36rpx;top: -18rpx;font-size: 22rpx;color: #999;">
								(身份信息只做审核使用)
							</view>
							<text class="text_6"><span style="color: red;">*</span>身份证证件号</text>
							<input type="text" v-model="cardsn" class="text_7" placeholder="输入身份证件号"
								placeholder-class="">
						</view>
						<view class="flex-row section_2">
							<text class="text_3"><span style="color: red;">*</span>达人性别</text>
							<u-radio-group style="margin-left: 48rpx;" v-model="radiovalue1" placement="row">
								<u-radio :customStyle="{'marginBottom': '8px'}" v-for="(item, index) in radiolist1"
									:key="index" style="margin-right: 8rpx;" activeColor=" rgb(24, 181, 103)"
									:label="item.name" :name="item.name">
								</u-radio>
							</u-radio-group>
						</view>
						<view class="section_3 flex-row">
							<text class="text_8"><span style="color: red;">*</span>达人年龄</text>
							<input class="text_9" type="number" v-model.trim="age" placeholder="请输入年龄" />
						</view>
						<view class="section_3 flex-row">
							<text class="text_6"><span style="color: red;">*</span>身高</text>
							<input type="text" style="flex: 1;" v-model.trim="height" class="text_7" placeholder="输入身高"
								placeholder-class="">
							<text class="text_6">cm</text>
						</view>
						<view class="section_3 flex-row">
							<text class="text_6"><span style="color: red;">*</span>体重</text>
							<input type="text" style="flex: 1;" v-model.trim="weight" class="text_7" placeholder="输入体重"
								placeholder-class="">
							<text class="text_6">kg</text>
						</view>
						<!-- <view class="section_3 flex-row">
							<text class="text_6">生日</text>
							<input type="text" v-model="birthday"class="text_7" placeholder="输入身高"
								placeholder-class="" >
						</view> -->



						<view class="personalProfile" @click="show3=true">
							<view class="det"><span style="color: red;">*</span>
								个人爱好
							</view>
							<input type="text" style="flex: 1;" v-model="tags" disabled="" class="text_7"
								placeholder="爱好" placeholder-class="">
							<!-- <view class="tages">
								<view :class="(item.state?'tages-boxplus':'tages-box')" v-for="(item,index) in tips"
									:key="index" @click="selecttage(item)">
									<text>{{item.name}}</text>
								</view>
							</view> -->
							<!-- :disabled='true' -->
							<!-- <textarea class="textarea" v-model="personalProfile" placeholder="输入您的个人爱好"
								style="height:224rpx;" /> -->
						</view>
						<view class="section_3 justify-between" @click="selectedCity" style="position: relative;">
							<view class=""
								style="position: absolute;left: 36rpx;bottom: -10rpx;font-size: 22rpx;color: #999;">
								(默认此地点方圆50KM为服务范围，范围可在达人端修改)
							</view>
							<view class="flex-row">
								<text class="text_10"><span style="color: red;">*</span>服务位置</text>
								<!-- <tm-pickersCity @confirm="selectedCity" btn-color="bg-gradient-deep-purple-accent"
									class="text_11">
								</tm-pickersCity> -->
								<view class="text_9" style="width: 440rpx; overflow: hidden;">
									{{ currentSite.address ? currentSite.address : '选择服务位置' }}
								</view>
								<!-- <input class="text_9" type="text" disabled v-model="city" placeholder="请选择位置" /> -->
							</view>
							<image
								src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61ab188e1f655f0011bbaece/61e7d9270c0e3200129ec72c/16425844611732717437.png"
								class="image_5" />
						</view>
						<view class="section_3 justify-between" @click="show2=true">
							<view class="flex-row">
								<text class="text_10"><span style="color: red;">*</span>服务项目</text>

								<view class="text_9" style="width: 440rpx;">{{ service_ids!='' ? '已选' : '选择服务项目' }}
								</view>
							</view>
							<image
								src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61ab188e1f655f0011bbaece/61e7d9270c0e3200129ec72c/16425844611732717437.png"
								class="image_5" />
						</view>
						<view class="flex-col section_4">
							<text>
								<span style="color: red;">*</span>
								请上传本人近期照片
								<span style="font-size: 26rpx;color: #999;">(要求三张)</span>
							</text>

							<view class="item" v-for="(item,i) in list" :key="i">
								<image :src="item" mode="aspectFill" class="avatar"></image>
								<view class="del" @tap="del(i)">删除</view>
								<!-- 								<view class="del" @tap="del(i)" v-if="zt!=0">删除</view> -->
							</view>
							<view class="flex-col group_4" @click="upload" v-show="list.length != 3">
								<image
									src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61ab188e1f655f0011bbaece/61e7d9270c0e3200129ec72c/16425844659951094858.png"
									class="image_6" />
								<image
									src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61ab188e1f655f0011bbaece/61e7d9270c0e3200129ec72c/16425844713277306992.png"
									class="image_7" />

								<!-- <image class="avatar" v-if="avatar" :src="avatar" mode=""></image> -->
							</view>
						</view>
						<view class="flex-col section_4">
							<text><span style="color: red;">*</span>请上传身份证正面照片</text>
							<view class="flex-col group_4" @click="upload1">
								<image
									src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61ab188e1f655f0011bbaece/61e7d9270c0e3200129ec72c/16425844659951094858.png"
									class="image_6" />
								<image
									src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61ab188e1f655f0011bbaece/61e7d9270c0e3200129ec72c/16425844713277306992.png"
									class="image_7" />

								<image class="avatar" v-if="positive" :src="positive" mode=""></image>
							</view>
						</view>
						<view class="flex-col section_4">
							<text><span style="color: red;">*</span>请上传身份证反面面照片</text>
							<view class="flex-col group_4" @click="upload2">
								<image
									src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61ab188e1f655f0011bbaece/61e7d9270c0e3200129ec72c/16425844659951094858.png"
									class="image_6" />
								<image
									src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61ab188e1f655f0011bbaece/61e7d9270c0e3200129ec72c/16425844713277306992.png"
									class="image_7" />

								<image class="avatar" v-if="verso" :src="verso" mode=""></image>
							</view>
						</view>
					</view>

					<view class="gouxuan">
						<u-checkbox-group>
							<u-checkbox size="24rpx" shape="circle" activeColor="#6D70EA " :checked="checked"
								labelSize="12" labelColor="#fff" label="同意并勾选" @change="checked = !checked">
							</u-checkbox>
						</u-checkbox-group>
						<text class="xieyi" @click="xieyi">《达人合作承诺书》</text>
					</view>
					<view class="flex-row-center">
						<view class="flex-col items-center button" @click="submit">
							<text>提交</text>
						</view>
					</view>


				</view>
			</view>
			<!--城市选择-->
			<!-- 	<view class="yin" v-show="flag">
				<view class="boxserss">
					<view class="topser">
						<image class="topsrcomage" src="../../../static/demo/top.png"></image>
					</view>
					<view class="centerser">
						<image class="sersdrefuia" src="../../../static/demo/center.png"></image>
						<view class="tyop">{{mssg}}！</view>
					</view>

					<view class="textbackground" @click="goFan"><text>我知道了</text></view>

				</view>

			</view> -->
			<!-- 服务项目 -->
			<u-popup :show="show2" @close="show2=false" :round="15" mode="bottom">
				<view class="serviceItems">
					<!-- 项目-->
					<view class="serviceItems-wrap">
						<view class="service-item" v-for="(item,index) in serviceData" :key="item.id">
							<view class="service-item-img">
								<image :src="item.master_image" style="width: 100%; height: 100%;" mode=""></image>
							</view>
							<view class="service-item-right">
								<view class="flex-row-flex-start" style="margin-bottom: 50rpx;">
									<view class="name">
										{{item.name}}
									</view>
									<view class="time">
										服务时间 : {{item.duration}}小时
									</view>
								</view>

								<!-- <view class="time flex-row-flex-start">
									<view class="">
										接单地址:
									</view>
									<input v-model="item.site"
										style="background: #f4f4f4;width: 254rpx; font-size: 28rpx;" type="text"
										placeholder="无固定场所可不填写" />
								</view> -->

								<!-- <view class="time flex-row-flex-start">
									<view class="">
										最低消费:
									</view>
									<input v-model="item.mininum_order_price"
										style="background: #f4f4f4;width: 220rpx;font-size: 28rpx;" type="text"
										placeholder="请输入最低消费" />
								</view> -->
								<!-- <view class="money flex-row-flex-start">
									最低:{{item.minimum_price}}
									<u-number-box v-model="item.price" :min="item.minimum_price"
										:max="item.maximum_price" decimalLength='2'>
										<view slot="minus" class="minus">
											<u-icon name="minus" color="#FFFFFF" size="12"></u-icon>
										</view>
										<view slot="input" style="width: 70px;font-size: 32rpx;background: #f4f4f4;"
											class="input">
											￥<input type="number" v-model="item.price"> </view>
										<view slot="plus" class="plus">
											<u-icon name="plus" color="#FFFFFF" size="12"></u-icon>
										</view>
									</u-number-box>
									最高:{{item.maximum_price}}
								</view> -->
								<view class="money flex-row-flex-start">
									价格:{{parseInt(item.price)}}
								</view>


							</view>
							<view class="icon">
								<radio @click="tigger(item.id)" :value="item.id+''"
									:checked="serviceData[`${index}`].is_check" />

							</view>
						</view>
					</view>

					<view class="btn">
						<view class="btn-b" @click="Pushclick()">
							<text>确认</text>
						</view>
					</view>
				</view>
			</u-popup>
			<!-- 服务项目 -->
			<u-popup :show="show3" @close="show3=false" :round="15" mode="bottom">
				<view class="popup-content">
					<view class="box">
						<view class="title">
							选择爱好(最多5个)
						</view>

						<view class="item-box">
							<view :class="item.check?'item i':'item'" v-for="(item,i) in tips" :key="i"
								@click="get(item)">
								{{item.title}}
							</view>
						</view>
					</view>
					<view class="btn">
						<view class="btn-b" @click="confirm()">
							<text>确认</text>
						</view>
					</view>
				</view>
			</u-popup>
		</view>
		<Flame-chooseLocation v-model="cityshow" mapkey="XIKBZ-INHKI-FOPGM-URZ5L-FLXZE-DPBVR" @confirm="confirm1">
		</Flame-chooseLocation>
	</view>
</template>

<script>
	import tmPickersCity from '@/tm-vuetify/components/tm-pickersCity/tm-pickersCity.vue';
	import {
		uploadImage
	} from '@/config/utils'
	export default {
		components: {
			tmPickersCity
		},
		data() {
			return {
				cityshow:false,
				checked: false,
				url_link: 'https://play.bozhoukeji.cn/jh5',
				radiolist1: [{
						name: '男',
						disabled: false
					},
					{
						name: '女',
						disabled: false
					}
				],
				clockText: '获取验证码',
				phone_code: '', //验证码
				tags: '',
				list: [],
				list2: [], // 单次上传数量存放
				mssg: '',
				user: '',
				nickname: '', //昵称
				height: "", //身高
				weight: '',
				birthday: "",
				// u-radio-group的v-model绑定的值如果设置为某个radio的name，就会被默认选中
				radiovalue1: '男',
				realname: '',
				positive: "", //正面
				verso: "", // 反面
				cardsn: '', //身份证件号，
				mobile: '',
				city: '',
				age: "",
				avatar: '',
				desc: '',
				status: -1,
				flag: false,
				flag1: false,
				province: '',
				district: '',
				personalProfile: '',
				tips: [],
				pid: '',

				//弹窗
				show2: false,
				serviceData: [],
				service: '',
				prices: [],
				service_ids: [],
				site: [],
				mininum_order_price: [],
				currentSite: {
					city: '',
					province: '',
					district: '',
					address: '',
				},
				lat: '',
				lng: '',
				radius: 50,


				show3: false,
			};
		},
		onLoad(option) {
			// uni.setStorageSync('pid','')
			let isIndex = uni.getStorageSync('isIndex')
			console.log(isIndex, 1111111111111);
			console.log(option);
			if (option.pid) {
				this.pid = option.pid
				uni.setStorageSync('pid', option.pid)
			} else {
				this.pid = uni.getStorageSync('pid')
			}
			if (!isIndex) {
				uni.showToast({
					title: '您还未登陆',
					icon: 'none',
					duration: 1000,
				});
				setTimeout(() => {
					uni.navigateTo({
						url: '/pages/user/login'
					})
				}, 1000)
			}
			this.$http.post('api/wx/short_url', {}).then(res => {
				console.log(res, "short_url")
				this.url_link = res.url_link

			})
			// this.$http.post('technician/index/service/list', {}).then(res => {
			// 	console.log(res, "technician/index/service/list")
			// 	// this.url_link = res.url_link

			// })
			this.getTags()

			// this.detail()
			this.getServiceItem()

		},
		methods: {
			confirm1 (val) {
			
				console.log(val, 'valvalvalvalvalvalvalvalvalvalvalvalvalvalvalvalvalvalvalvalvalvalvalval');
			
				this.lat = val.location.lat;
				this.lng = val.location.lng;
				var currentSite = {
					province: '',
					city: '',
					district: '',
					address: ''
				};
				if (val.ad_info) {
					currentSite.province = val.ad_info.province
					currentSite.city = val.ad_info.city
					currentSite.district = val.ad_info.district
					currentSite.address = val.address + val.title
				}
				else {
					currentSite.province = val.province
					currentSite.city = val.city
					currentSite.district = val.district
					currentSite.address = val.address + val.title
				}
			
				this.currentSite = currentSite
				// this.selectLocatin = val
			},
			get(item) {
				if (this.tags.split(',').length >= 5 && item.check == false) return
				let arr = []
				item.check = !item.check
				console.log(item);
				this.tips.forEach(i => {
					if (i.check) {
						arr.push(i.title)
					}
				})
				this.tags = arr.join(',')
				console.log(this.tags);
			},
			confirm() {
				this.show3 = false

			},
			send() {
				if (!(/^1[3456789]\d{9}$/.test(this.mobile))) {
					uni.showToast({
						icon: 'none',
						title: '请输入正确格式的手机号'
					});
					return;
				}
				uni.request({
					url: 'https://play.bozhoukeji.cn/api/send/sms',
					method: 'POST',
					header: {
						'Content-Type': 'application/json',
					},
					data: {
						phone: this.mobile,
						type: 0
					},
					success: res => {
						console.log(res);
						this.sendCode();
					},
					fail: (err) => {
						console.log(err);
					},
					complete: () => {}
				});

			},
			sendCode() {

				this.clock = 60;
				let timer = setInterval(() => {
					this.clock--;
					this.clockText = `${this.clock} 秒`
					if (this.clock < 1) {
						clearInterval(timer);
						this.clockText = '获取验证码'
						// this.clock = 0
					}
				}, 1000)

			},
			getServiceItem() {
				this.$http.post('api/service/list', {
					order_type: 'desc',
					sort_type: '综合排序'
				}).then(res => {
					console.log(res);
					for (let i = 0; i < res.length; i++) {
						res[i].maximum_price = parseInt(res[i].maximum_price)
						res[i].minimum_price = parseInt(res[i].minimum_price)

					}
					this.serviceData = res
				})
			},
			tigger(index) {
				this.service_ids = []
				this.prices = []
				for (var i = 0; i < this.serviceData.length; i++) {
					if (this.serviceData[i].id == index) {
						this.serviceData[i].is_check = !this.serviceData[i].is_check

					}
				}
			},

			Pushclick() {
				this.service_ids = []
				this.prices = []
				this.site = []
				this.mininum_order_price = []
				for (var i = 0; i < this.serviceData.length; i++) {
					if (this.serviceData[i].is_check) {
						this.service_ids.push(this.serviceData[i].id)
						this.prices.push(this.serviceData[i].price)
						this.site.push(this.serviceData[i].site)
						this.mininum_order_price.push(this.serviceData[i].mininum_order_price)
					}

				}
				this.show2 = false
				console.log(this.service_ids, this.prices, this.site, this.mininum_order_price);
				// this.setServiceItem(this.service_ids, this.prices, this.site, this.mininum_order_price, )
			},



			//
			xieyi() {
				uni.navigateTo({
					url: '/bundle/pages/settled/EntryAgreement'
				})
			},
			togo() {
				this.status = -1
			},
			del(e) {
				this.list.splice(e, 1);
			},
			getTags() {
				// this.tages[0].name = 111
				this.$db.http('api/sys/tags').then(res => {
					this.tages = res.data
					for (let i = 0; i < this.tages.length; i++) {
						this.tips.push({
							title: '',
							check: false
						})
						this.tips[i].title = this.tages[i]
					}
					console.log(this.tips, '-------')
				})
			},
			//上传图片
			uploadImg(e, num, is) {
				let _this = this
				let token = uni.getStorageSync('token')
				uni.uploadFile({
					url: 'https://play.bozhoukeji.cn/api/upload',
					filePath: e,
					name: 'file',
					header: {
						token: _this.$db.get('token')
					},
					success: (res) => {
						/* console.log(res,"请求接口打的印") */
						let _data = JSON.parse(res.data);
						console.log(_data, "打印的接口数据")
						if (_data.code == 200) {
							console.log(1, is, num)
							if (is) {

								// 相册
								_this.list = _this.list.concat(_data.data.path)
								console.log(_this.list, "相册的值")
								_this.list2.push(_data.data.path)

								if (_this.list2.length == num) {
									_this.list2 = []
									uni.hideLoading()
								}
							} else {
								// 头像
								_this.img = _data.data.path
								console.log(_this.img, "打印的this.img")
								uni.hideLoading()
							}
						}
					}
				});
			},
			detail() {

				this.$http.post('api/user/detail', {}).then(res => {
					this.user = res
					this.status = res.technician_apply_status
					// this.status=2
					console.log(res.technician_apply_status, "打印的222222222222222222222")
					this.mobile = res.phone
					if (res.technician_apply_status == -1) {
						this.mssg = res.technician_apply_status
						// uni.showToast({
						// 	icon:'none',
						// 	// title:res.desc,
						// })
						console.log(res.desc, "等于-1的时候未申请")
					} else if (res.technician_apply_status == 1) {
						this.mssg = '您的审核已通过'
						this.flag = true
						this.flag1 = true
						// uni.showToast({
						// 	icon:'none',
						// 	// title:res.desc
						// })
						console.log(res.technician_apply_status, "等于1的时候审核通过")
					} else if (res.technician_apply_status == 0) {
						this.mssg = '审核中'
						console.log(res.technician_apply_status, "等于0的时候审核中")
						this.flag = true
						// uni.showToast({
						// 	icon:'none',
						// 	// title:res.desc
						// })
					} else if (res.technician_apply_status == 2) {
						this.mssg = '已驳回'
						console.log(res.technician_apply_status, "等于0的时候审核中")
						this.flag1 = true
						// uni.showToast({
						// 	icon:'none',
						// 	// title:res.desc
						// })
					}
				})
			},
			leftClick() {
				uni.navigateBack()
			},
			goFan() {
				// #ifdef APP-PLUS
				plus.runtime.openURL(this.url_link) //这里默认使用外部浏览器打开而不是内部web-view组件打开
				// #endif
				// #ifdef H5
				window.open(this.url_link)
				// #endif
				// uni.switchTab({
				// 	url:'/pages/my/my'
				// })
				// setTimeout( ()=>{
				// 	uni.switchTab({
				// 		url:'/pages/my/my'
				// 	})
				// },800)
			},
			// selectedCity(e) {
			// 	this.city = e[1]
			// 	this.province = e[0]
			// 	this.district = e[2]
			// 	console.log(this.city, "fnain")
			// },
		
		selectedCity () {
			this.cityshow = true
			// uni.chooseLocation({
			// 	success: (res) => {
			// 		uni.showToast({
			// 			title: '获取经纬度成功',
			// 			icon: 'none'
			// 		});
			// 		let latAndLng = {}
			// 		latAndLng.lat = res.latitude
			// 		latAndLng.lng = res.longitude
			// 		this.lat = res.latitude
			// 		this.lng = res.longitude
			// 		// let currentSite = {}
			// 		var regex = /^(北京市|天津市|重庆市|上海市|香港特别行政区|澳门特别行政区)/;
			// 		var REGION_PROVINCE = [];
			// 		var currentSite = {
			// 			province: '',
			// 			city: '',
			// 			district: '',
			// 			address: ''
			// 		};
			// 		console.log(res)
			// 		var reg = /.+?(省|市|自治区|自治州|县|区)/g;
			// 		var addressList = res.address.match(reg)
			// 		console.log(res.address + ': ', res.address.match(reg));
			// 		if (addressList[0] == '北京市' || addressList[0] == '天津市' || addressList[0] == '上海市' ||
			// 			addressList[0] == '重庆市') {
		
			// 			if (addressList.length > 0) {
			// 				currentSite.province = addressList[0];
		
			// 			}
			// 			if (addressList.length > 1) {
			// 				currentSite.city = addressList[0];;
			// 			}
			// 			if (addressList.length > 2) {
			// 				currentSite.district = addressList[1];;
			// 			}
			// 			if (addressList.length > 1) {
			// 				var str = addressList[1]
			// 				var list = res.address.split(str)
			// 				console.log(list)
			// 				if (list.length > 1) {
			// 					currentSite.address = list[1] + res.name;
			// 				}
			// 			}
		
		
			// 		} else {
			// 			if (addressList.length > 0) {
			// 				currentSite.province = addressList[0];
		
			// 			}
			// 			if (addressList.length > 1) {
			// 				currentSite.city = addressList[1];
			// 			}
			// 			if (addressList.length > 2) {
			// 				currentSite.district = addressList[2];
			// 			}
			// 			if (addressList.length > 0) {
			// 				var str = addressList[addressList.length - 1]
			// 				var list = res.address.split(str)
			// 				console.log(list)
			// 				if (list.length > 1) {
			// 					currentSite.address = list[1] + res.name;
			// 				}
			// 			}
			// 		}
		
			// 		this.currentSite = currentSite
			// 		console.log(currentSite, "1：currentSite")
			// 		console.log(this.lat,
			// 			this.lng, this.currentSite);
		
		
			// 		console.log('位置名称：' + res.name);
			// 		console.log('详细地址：' + res.address);
			// 		console.log('纬度：' + res.latitude);
			// 		console.log('经度：' + res.longitude);
			// 	},
			// 	fail: (err) => {
			// 		uni.showToast({
			// 			title: '获取经纬度失败' + err,
			// 			icon: 'none'
			// 		});
			// 		console.log("获取经纬度失败");
			// 		console.log(err)
			// 		// checkOpenGPSServiceByAndroid()
		
			// 	},
			// });
		},
		upload() {
				uni.chooseImage({
					count: 3 - this.list.length,
					success: (res) => {
						// console.log(res);
						let {
							tempFilePaths
						} = res;

						tempFilePaths.forEach(item => {
							// this.recursionCompressH5(item)
							this.getFileInfo(item)
						})
						return

						tempFilePaths.forEach(item => {
							uploadImage(item).then(res => {
								this.list.push(res.path)
								// this.list = this.list.concat(res.path)
								console.log(res, '/*/*/*/*/');

							})
							console.log(tempFilePaths)
						})

					}
				})
			},
			upload1() {
				uni.chooseImage({
					count: 1,
					success: (res) => {
						let {
							tempFilePaths
						} = res;
						let filePath = tempFilePaths[0]
						uploadImage(filePath).then(res => {
							this.positive = res.path;
							console.log(res, '/*/*/*/*/');

						})
						console.log(tempFilePaths)
					}
				})
			},
			upload2() {
				uni.chooseImage({
					count: 1,
					success: (res) => {
						let {
							tempFilePaths
						} = res;
						let filePath = tempFilePaths[0]
						uploadImage(filePath).then(res => {
							this.verso = res.path;
							console.log(res, '/*/*/*/*/');

						})
						console.log(tempFilePaths)
					}
				})
			},
			upload3() {
				uni.chooseImage({
					count: 1,
					success: (res) => {
						let {
							tempFilePaths
						} = res;
						let filePath = tempFilePaths[0]
						uploadImage(filePath).then(res => {
							this.avatar = res.path;
							console.log(res, '/*/*/*/*/');

						})
						console.log(tempFilePaths)
					}
				})
			},
			//选择图片
			choiceImg(is) {
				/* if(this.zt==0){ return} */
				let _this = this
				uni.chooseImage({
					success: function(res) {
						console.log(JSON.stringify(res.tempFilePaths), "头像打印");
						uni.showLoading({
							title: '图片上传中'
						})
						let a = res.tempFilePaths //选择图片路径
						for (let i in a) {
							_this.uploadImg(a[i], a.length, is)
							// _this.uploadImg(a[i],is)
						}
					}
				})
			},

			submit() {
				// console.log(this.currentSite.province);

				// if (!this.avatar) {
				// 	uni.showToast({
				// 		icon: 'none',
				// 		title: '请输入头像'
				// 	});
				// 	return;
				// }
				if (!this.nickname) {
					uni.showToast({
						icon: 'none',
						title: '请输入昵称'
					});
					return;
				}
				if (!this.realname) {
					uni.showToast({
						icon: 'none',
						title: '请输入达人姓名'
					});
					return;
				}
				if (!(/^1[3456789]\d{9}$/.test(this.mobile))) {
					uni.showToast({
						icon: 'none',
						title: '请输入正确格式的手机号'
					});
					return;
				}
				if (!this.phone_code) {
					uni.showToast({
						icon: 'none',
						title: '请输入验证码'
					});
					return;
				}
				if (!this.age) {
					uni.showToast({
						icon: 'none',
						title: '请输入达人年纪'
					});
					return;
				}
				if (!this.service_ids) {
					uni.showToast({
						icon: 'none',
						title: '请选择服务项目'
					});
					return;
				}
				if (!this.currentSite.address) {
					uni.showToast({
						icon: 'none',
						title: '请选择服务地址'
					});
					return;
				}

				if (!this.cardsn) {
					uni.showToast({
						icon: 'none',
						title: '请输入身份证'
					});
					return;
				}
				if (!this.height) {
					uni.showToast({
						icon: 'none',
						title: '请输入身高'
					});
					return;
				}
				if (!this.weight) {
					uni.showToast({
						icon: 'none',
						title: '请输入体重'
					});
					return;
				}
				if (this.list.length != 3) {
					uni.showToast({
						icon: 'none',
						title: '本人照片要求三张'
					});
					return;
				}
				if (!this.positive) {
					uni.showToast({
						icon: 'none',
						title: '请输入身份证正面'
					});
					return;
				}
				if (!this.verso) {
					uni.showToast({
						icon: 'none',
						title: '请输入身份证反面'
					});
					return;
				}

				if (!this.tags) {
					uni.showToast({
						icon: 'none',
						title: '请先选择爱好'
					});
					return;
				}
				if (!this.checked) {
					uni.showToast({
						icon: 'none',
						title: '请勾选协议'
					});
					return;
				}
				// if (!this.city) {
				// 	uni.showToast({
				// 		icon: 'none',
				// 		title: '请先选择意向工作城市'
				// 	});
				// 	return;
				// }
				this.$http.post('api/user/technician/apply', {
					service_ids: this.service_ids.join(','),
					prices: this.prices.join(','),
					sites: this.site.join(','),
					mininum_order_prices: this.mininum_order_price.join(','),
					province: this.currentSite.province,
					city: this.currentSite.city,
					district: this.currentSite.district,
					address: this.currentSite.address,
					latitude: this.lat,
					longitude: this.lng,
					radius: 50,

					nickname: this.nickname,
					phone: this.mobile,
					phone_code: this.phone_code,
					age: this.age,
					// city: this.city,
					avatar: this.avatar,
					sex: this.radiovalue1,
					// province: this.province,
					// district: this.district,
					id_card_front_img: this.positive,
					id_card_verso_img: this.verso,
					id_card_username: this.realname,
					id_card_code: this.cardsn,
					height: this.height,
					weight: this.weight,
					// avatar: this.img, // 头像
					album: this.list.join(','), // 相册
					// album: JSON.stringify(this.list), // 相册
					pid: this.pid,
					// sex: this.sex,
					// age: this.age,
					intro: this.tags,
				}).then(res => {
					console.log(res, 'apply');
					uni.setStorageSync('pid', '')
					// plus.runtime.openURL( 'https://www.pgyer.com/Jix5');
					uni.showToast({
						icon: 'none',
						title: '提交成功'
					})
					setTimeout(() => {
						this.detail()
						uni.navigateBack({
							delta: 1
						})
					}, 1000)

					// setTimeout(() =>{

					// },1000)
				})
			},
			getFileInfo(imgSrc) { //判断是否压缩
				uni.getFileInfo({
					filePath: imgSrc,
					success: (resFileInfo) => {
						if (resFileInfo.size > 1024 * 200) {
							//				压缩后大于  ↑  就继续压缩
							this.recursionCompressH5(imgSrc);
							return;
						} else {

							uploadImage(imgSrc).then(res => {
								this.list.push(res.path)
								// this.list = this.list.concat(res.path)
								console.log(res, '/*/*/*/*/');

							})
						}
					},
				});
			},
			recursionCompressH5(url) {
				uni.getImageInfo({
					src: url,
					success: (res) => {
						console.log(res);
						let canvasWidth = res.width; //图片原始长宽
						let canvasHeight = res.height;
						let img = new Image();
						img.src = res.path;
						let canvas = document.createElement("canvas");
						let ctx = canvas.getContext("2d");
						canvas.width = canvasWidth / 2;
						canvas.height = canvasHeight / 2;
						ctx.drawImage(img, 0, 0, canvasWidth / 2, canvasHeight / 2);
						canvas.toBlob((fileSrc) => {
							let imgSrc = window.URL.createObjectURL(fileSrc);
							uni.getFileInfo({
								filePath: imgSrc,
								success: (resFileInfo) => {
									if (resFileInfo.size > 1024 * 200) {
										//				压缩后大于  ↑  就继续压缩
										this.recursionCompressH5(imgSrc);
										return;
									} else {
										//小于就转化base64
										let resultBase64 = canvas.toDataURL(
											"image/png")
										// console.log(resultBase64);
										uploadImage(resultBase64).then(res => {
											this.list.push(res.path)
											// this.list = this.list.concat(res.path)
											console.log(res, '/*/*/*/*/');

										})
									}
								},
							});
						});
					}
				})
			}
		},

	};
</script>


<style scoped lang="scss">
	page {
		background-color: #ffffff00;
	}

	.item {
		line-height: 80rpx;
		text-align: center;
	}

	.popup-content {
		width: 750rpx;
		// height: 846rpx;
		background: #FFFFFF;
		border-radius: 20rpx 20rpx 0rpx 0rpx;
		padding-bottom: 5vh;
		opacity: 1;

		// padding-top: 30rpx;
		.header {
			padding: 60rpx;
		}

		.t1 {
			font-size: 46rpx;
			font-family: PingFang SC;
			color: #333333;
			margin: 100rpx 0 30rpx;
		}

		.t2 {
			font-size: 28rpx;
			font-family: PingFang SC;
			color: #999999;
		}

		button {
			width: 650rpx;
			line-height: 100rpx;
			background: linear-gradient(0deg, #0D96FF 0%, #4760FF 100%);
			border-radius: 50rpx;
			font-size: 32rpx;
			font-family: PingFang SC;
			color: #FFFFFF;
			margin: 40rpx auto;
		}
	}

	.box {
		height: 50vh;
		padding: 20rpx 0 20rpx 20rpx;

		.title {
			font-size: 30rpx;
			font-weight: bold;
			color: #333333;
		}

		.item-box {
			display: flex;
			flex-wrap: wrap;
		}

		.item {
			width: 154rpx;
			line-height: 60rpx;
			font-size: 28rpx;
			color: #666666;
			border: 1px solid #DDDDDD;
			border-radius: 30rpx;
			margin: 20rpx 20rpx 0 0;
		}

		.i {
			color: #4265FF;
			border: 1px solid #4265FF;
		}
	}

	.centent_code {
		color: #000;
		position: absolute;
		font-size: 26rpx;
		text-align: center;
		line-height: 52rpx;
		top: 20rpx;
		right: 0rpx;
		width: 160rpx;
		height: 52rpx;

	}

	.personalProfile {
		width: 100%;
		background-color: #ffffff;
		padding: 28rpx;

		.det {
			font-size: 28rpx;
			background-color: #ffffff;
			// font-weight: bold;
			color: #000000;
			// padding-left: 28rox;
			margin-top: 40rpx;
			margin-bottom: 16rpx;
		}

		.textarea {
			box-sizing: border-box;
			padding: 28rpx;
			width: 100%;
			height: 360rpx;
			background: #F7F8F9;
			border-radius: 16rpx;
		}
	}

	.border-radius-100 {
		border-radius: 200rpx !important;
	}

	.position-relative {
		margin: 0 auto;
		position: relative;
		text-align: center;
		margin-bottom: 20rpx;
	}

	.position-absolute {
		position: absolute;
	}

	/*正 图片宽度*/
	.img {
		vertical-align: middle;
		border-radius: 50%;
	}

	// .img2{ vertical-align: top; background: url(@/static/images/loading.gif) center center no-repeat;background-size:40rpx 40rpx;}
	.BGImage1 {
		position: fixed;
		width: 100%;
		height: 100%;
		bottom: 0;
		top: 0;
		left: 0;
		z-index: -1;
	}

	.bgView {
		width: 100%;
		height: 100vh;
	}

	.bgView1 {
		width: 690rpx;
		height: 581rpx;
		background: #FFFFFF;
		border-radius: 20rpx;
		border: 10rpx solid #1E8554;
	}

	.image {
		width: 284rpx;
		height: 228rpx;
	}

	.title {
		margin-top: 12rpx;
		font-size: 34rpx;
		font-family: PingFang SC;
		// font-weight: 500;
		color: #333333;
	}

	.button {
		margin-top: 53rpx;
		width: 579rpx;
		height: 93rpx;
		background: #0DA17D;
		border-radius: 47rpx;
		font-size: 34rpx;
		font-family: PingFang SC;
		// font-weight: bold;
		color: #FFFFFF;
	}

	.topsrcomage {
		width: 100%;
		height: 100%;
	}

	.tyop {
		text-align: center;
	}

	.sersdrefuia {
		height: 550rpx;
	}

	.textbackground {
		width: 90%;
		height: 70rpx;
		background-color: #0da17d;
		color: white;
		border-radius: 50rpx;
		align-items: center;
		text-align: center;
		line-height: 70rpx;
		font-size: 30rpx;
		margin: 150rpx auto;
	}

	.centerser {
		width: 80%;
		height: 650rpx;
		background-color: white;
		border-radius: 15rpx;
		margin: -60rpx auto;
	}

	.topser {
		background-color: #17ba92;
		width: 100%;
		height: 350rpx;
	}

	.boxserss {
		width: 100%;
		height: 100%;
		background-color: #f5f5f5;
	}

	.yin {
		width: 100%;
		height: 100%;
		position: fixed;
		background-color: rgba(0, 0, 0, 0.8);
		z-index: 999;

	}

	.dog {
		width: 70%;
		height: 10%;
		background-color: white;
		border-radius: 8rpx;
		margin: 100rpx auto;
		display: flex;
		align-items: center;
		justify-content: center;
	}



	.page {
		// background-color: #f8f8f8;
		width: 100%;
		height: 100%;
		overflow-y: auto;

		.group {
			// padding-bottom: 100rpx;
			flex: 1 1 auto;
			overflow-y: auto;

			.image_1 {
				width: 100%;
				height: 400rpx;
			}

			.group_1 {
				margin-top: 400rpx;
				/* #ifdef MP||APP-PLUS */
				margin-top: 460rpx;
				/* #endif */

				padding: 0 32rpx;
				position: relative;

				.button {
					margin-top: 10rpx;
					margin-bottom: 50rpx;
					padding: 22rpx 0;
					color: rgb(255, 255, 255);
					font-size: 32rpx;
					font-weight: 500;
					line-height: 44rpx;
					white-space: nowrap;
					background-color: rgb(24, 181, 103);
					border-radius: 44rpx;
				}

				.section_1 {
					padding: 28rpx 24rpx;
					background-color: rgb(255, 255, 255);
					border-radius: 24rpx 24rpx 0px 0px;

					.text_1 {
						color: rgb(0, 0, 0);
						font-size: 28rpx;
						font-weight: 500;
						line-height: 40rpx;
						white-space: nowrap;
					}

					.text_2 {
						margin-left: 48rpx;
						color: rgb(153, 153, 153);
						font-size: 28rpx;
						line-height: 40rpx;
						white-space: nowrap;
					}
				}

				.section_2 {
					padding: 24rpx 24rpx 26rpx;
					color: rgb(0, 0, 0);
					font-size: 28rpx;
					font-weight: 500;
					line-height: 40rpx;
					white-space: nowrap;
					background-color: rgb(255, 255, 255);

					.text_3 {
						margin-top: 4rpx;
					}

					.image_2 {
						width: 44rpx;
						height: 44rpx;
					}

					.image_3 {
						margin-left: 48rpx;
					}

					.text_4 {
						margin-left: 4rpx;
						margin-top: 4rpx;
					}

					.image_4 {
						margin-left: 40rpx;
					}

					.text_5 {
						margin-left: 4rpx;
						margin-bottom: 4rpx;
					}
				}

				.section_3 {
					padding: 28rpx 24rpx;
					background-color: rgb(255, 255, 255);

					.text_6 {
						color: rgb(0, 0, 0);
						font-size: 28rpx;
						font-weight: 500;
						line-height: 40rpx;
						white-space: nowrap;
					}

					.text_7 {
						margin-left: 48rpx;
						color: rgb(153, 153, 153);
						font-size: 28rpx;
						line-height: 40rpx;
						white-space: nowrap;
					}

					.text_8 {
						color: rgb(0, 0, 0);
						font-size: 28rpx;
						font-weight: 500;
						line-height: 40rpx;
						white-space: nowrap;
					}

					.text_9 {
						margin-left: 48rpx;
						color: rgb(153, 153, 153);
						font-size: 28rpx;
						line-height: 40rpx;
						white-space: nowrap;
					}

					.image_5 {
						margin-bottom: 6rpx;
						width: 32rpx;
						height: 32rpx;
					}

					.text_10 {
						color: rgb(0, 0, 0);
						font-size: 28rpx;
						font-weight: 500;
						line-height: 40rpx;
						white-space: nowrap;
					}

					.text_11 {
						margin-left: 48rpx;
						color: rgb(153, 153, 153);
						font-size: 28rpx;
						line-height: 40rpx;
						width: 450rpx;
					}
				}

				.section_4 {
					padding: 28rpx 23rpx 31rpx;
					color: rgb(0, 0, 0);
					font-size: 28rpx;
					font-weight: 500;
					line-height: 40rpx;
					white-space: nowrap;
					background-color: rgb(255, 255, 255);
					// border-radius: 0px 0px 24rpx 24rpx;

					.group_4 {
						margin-top: 31rpx;
						padding: 71rpx 0 71rpx;
						position: relative;

						.image_6 {
							margin-left: 71rpx;
							width: 56rpx;
							height: 56rpx;
						}

						.image_7 {
							border-radius: 24rpx;
							width: 198rpx;
							height: 198rpx;
							position: absolute;
							left: 0;
							top: 0;
						}

						.avatar {
							border-radius: 24rpx;
							position: absolute;
							width: 198rpx;
							height: 198rpx;
							position: absolute;
							left: 0;
							top: 0;
							z-index: 9;
						}
					}
				}
			}
		}
	}

	.gouxuan {
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 26rpx;
		color: #fff;
		line-height: 39rpx;
		margin-top: 90rpx;

		.xieyi {
			font-size: 26rpx;
			color: red;
			line-height: 39rpx;
		}
	}
</style>
<style lang="less">
	.minus {
		width: 22px;
		height: 22px;
		background-color: #28c375;
		border-radius: 50%;
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		justify-content: center;
		align-items: center;
	}

	.input {
		padding: 0 10px 0 0;
		display: flex;
		/* padding:  10rpx 20rpx 10rpx 20rpx ; */
	}

	.plus {
		width: 22px;
		height: 22px;
		background-color: #28c375;
		border-radius: 50%;
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		justify-content: center;
		align-items: center;
	}

	.serviceItems {
		width: 750rpx;
		height: 80vh;
		overflow-y: scroll;
		margin-top: 20rpx;

		.servicetips {
			width: 96%;
			height: 88rpx;
			background: #fff;
			font-size: 28rpx;
			font-weight: 400;
			color: #000000;
			line-height: 88rpx;
			text-indent: 24rpx;
			margin: 0 auto;
			margin-top: 24rpx;

		}

		.serviceItems-wrap {

			width: 96%;
			margin: 20rpx auto;
			padding-bottom: 150rpx;

			.service-item {
				position: relative;
				width: 100%;
				// height: 302rpx;
				display: flex;
				align-items: center;
				background: #fff;
				margin-top: 24rpx;
				border-radius: 16rpx;
				padding: 10rpx 0;

				.service-item-img {
					width: 176rpx;
					height: 154rpx;
					background: #A8A8A8;
					border-radius: 12rpx;
					margin-left: 24rpx;
				}

				.service-item-right {
					margin-left: 24rpx;
					// height: 154rpx;
					display: flex;
					flex-direction: column;
					justify-content: space-between;

					.name {
						font-size: 32rpx;
						color: #000000;
					}

					.time {
						margin-left: 6rpx;
						font-size: 28rpx;
						color: #666666;
					}

					.money {
						font-size: 26rpx;
						color: #FFB83C;
					}
				}
			}
		}

		.icon {
			position: absolute;
			top: 50%;
			transform: translateY(-50%);
			right: 50rpx;
		}
	}

	.btn {
		width: 95%;
		height: 100rpx;
		background-color: #fff;
		position: fixed;
		z-index: 999;
		left: 0;
		bottom: 0;
		display: flex;
		justify-content: flex-end;
		align-items: center;
		padding: 0 20rpx;

		.btn-b {
			width: 30%;
			height: 100%;
			border-radius: 20rpx;
			display: flex;
			color: #fff;
			justify-content: center;
			align-items: center;
			background-color: #28c375;

		}
	}
</style>